//
//  KDNetExpFrame.m
//  YuQingXiaoFang
//
//  Created by wangdongdong on 18/6/20.
//  Copyright © 2018年 KDTech. All rights reserved.
//

#import "KDNetExpFrame.h"
#import "KDNetExpModel.h"
#define KDNewsCellBorder 5
@implementation KDNetExpFrame
-(void) setModel:(KDNetExpModel *)model{
    _model=model;
    
    //标题
    CGFloat titleLabelX=KDNewsCellBorder;
    CGFloat titleLabelY=KDNewsCellBorder;
    CGSize titleLabelSize=[model.title sizeWithAttributes:@{NSFontAttributeName:KDNewsCellModelTitleFont} ];
    CGFloat titleW=titleLabelSize.width;
    //标题超出屏幕宽度，则设置为屏幕宽度
    if(titleW>(screenW-KDNewsCellBorder-titleLabelX)){
        titleLabelSize.width=screenW-KDNewsCellBorder-titleLabelX;
    }
    _titleLabelF=(CGRect){{titleLabelX,titleLabelY},titleLabelSize};
    
    
    //右箭头
    CGFloat rightArrowImageViewW=15;
    CGFloat rightArrowImageViewH=15;
    CGFloat rightArrowImageViewX=screenW-rightArrowImageViewW-KDNewsCellBorder;
    CGFloat rightArrowImageViewY=(titleLabelSize.height-rightArrowImageViewH)/2+KDNewsCellBorder;
    
    _rightArrowImageF=CGRectMake(rightArrowImageViewX,rightArrowImageViewY,rightArrowImageViewW,rightArrowImageViewH);
    
    
    // 计算cell的高度
    _cellHeight =  CGRectGetMaxY(_titleLabelF)+KDNewsCellBorder;
    
}

@end
